#pragma once

#include <iostream>
#include <pthread.h>
#include <cstring>
#include <string>
#include <cassert>


class Thread
{
public:
    typedef void*(*Func_t)(void*);
    static const int num = 1024;
public:
    Thread(void* args)
        :_args(args)
        {}

        void join()
        {
            int n = pthread_join(_tid, nullptr);
            assert(n == 0);
            (void)n;
        }

        void start(Func_t func_t)
        {
            _func_t = func_t;
            int n = pthread_create(&_tid, nullptr, _func_t, _args);
            assert(n == 0);
            (void)n;
        }


private:
    pthread_t _tid;
    Func_t _func_t;
    void* _args;
};

